package cn.caskm.souvenirshopsystem.controller.api;

import cn.caskm.souvenirshopsystem.domain.Result;
import cn.caskm.souvenirshopsystem.domain.dto.PageDTO;
import cn.caskm.souvenirshopsystem.domain.query.GoodsSearchQuery;
import cn.caskm.souvenirshopsystem.domain.vo.GoodsSearchVO;
import cn.caskm.souvenirshopsystem.service.SearchService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/search")
@RequiredArgsConstructor
public class SearchController {

    private final SearchService searchService;

    @GetMapping("/searchGoods")
    public Result<PageDTO<GoodsSearchVO>> searchGoods(GoodsSearchQuery query) {
        return Result.success(searchService.searchGoods(query));
    }

}
